package de.puc.defencetower;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

import de.puc.defencetower.controller.iGameController;
import de.puc.defencetower.controller.impl.GameController;
import de.puc.defencetower.model.Map;
import de.puc.defencetower.view.gui.GUIWindow;
import de.puc.defencetower.view.tui.TUIWindow;
import de.puc.defencetower.view.tui.panel.PanelWindow;

public class Main {

	private static Logger logger = Logger.getLogger("de.puc.defencetower.Main");

	private Main(){
		
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		PropertyConfigurator.configure("log4j.properties");

		logger.info("Welcome to PuC DefenceTower!!!"); 

		// Dialog starten
		JFrame jf = new JFrame();
		String[] possibilities = { "Mini", "Small", "Middle", "Big" };
		String selectedMap = (String) JOptionPane.showInputDialog(jf,
				"Select Map", "Map Selector", JOptionPane.PLAIN_MESSAGE, null,
				possibilities, possibilities[0]);
 
		// Map erzeugen
		Map map = null;
		if (selectedMap.equals(possibilities[0])) {
			map = MapFactory.createMiniMap();
		} else if (selectedMap.equals(possibilities[1])) {
			map = MapFactory.createSmallMap();
		} else if (selectedMap.equals(possibilities[2])) {
			map = MapFactory.createMiddleMap();
		} else if (selectedMap.equals(possibilities[3])) {
			map = MapFactory.createBigMap();
		}

		// GameControler starten
		iGameController gameControlerInterface = new GameController(map);
		gameControlerInterface.start();

		// Anzeige TUI
		new TUIWindow(gameControlerInterface, map);

		// Anzeige GUI
		new GUIWindow(gameControlerInterface, map);
		new PanelWindow(gameControlerInterface,map);
		
	}

}
